<!DOCTYPE html>
<html lang="en">

<!-- Head tag -->
<head><meta name="generator" content="Hexo 3.9.0">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content>
    <meta name="keyword" content>
    <link rel="shortcut icon" href="/myblog/img/favicon.ico">

    <title>
        
          java内存模型 - Ethan的博客 | Ethan&#39;s Blog
        
    </title>

    <link rel="canonical" href="http://reflectyi.gitee.io/myblog/myblog/2016/10/01/jvm/并发/java内存模型/">

    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" href="/myblog/css/bootstrap.min.css">

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/myblog/css/hux-blog.min.css">

    <!-- Pygments Highlight CSS -->
    <link rel="stylesheet" href="/myblog/css/highlight.css">

    <!-- Custom Fonts -->
    <!-- <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
    <!-- Hux change font-awesome CDN to qiniu -->
    <link href="https://cdn.staticfile.org/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">


    <!-- Hux Delete, sad but pending in China
    <link href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/
    css'>
    -->


    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- ga & ba script hoook -->
    <script></script>
</head>


<!-- hack iOS CSS :active style -->
<body ontouchstart="">

    <!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/myblog/">Hi,Ethan</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <!-- Known Issue, found by Hux:
            <nav>'s height woule be hold on by its content.
            so, when navbar scale out, the <nav> will cover tags.
            also mask any touch event of tags, unfortunately.
        -->
        <div id="huxblog_navbar">
            <div class="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="/myblog/">首页</a>
                    </li>

                    

                        
                    

                        
                        <li>
                            <a href="/myblog/about/">目录</a>
                        </li>
                        
                    

                        
                        <li>
                            <a href="/myblog/archives/">时间轴</a>
                        </li>
                        
                    

                        
                        <li>
                            <a href="/myblog/tags/">标签</a>
                        </li>
                        
                    
                    
                </ul>
            </div>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>
<script>
    // Drop Bootstarp low-performance Navbar
    // Use customize navbar with high-quality material design animation
    // in high-perf jank-free CSS3 implementation
    var $body   = document.body;
    var $toggle = document.querySelector('.navbar-toggle');
    var $navbar = document.querySelector('#huxblog_navbar');
    var $collapse = document.querySelector('.navbar-collapse');

    $toggle.addEventListener('click', handleMagic)
    function handleMagic(e){
        if ($navbar.className.indexOf('in') > 0) {
        // CLOSE
            $navbar.className = " ";
            // wait until animation end.
            setTimeout(function(){
                // prevent frequently toggle
                if($navbar.className.indexOf('in') < 0) {
                    $collapse.style.height = "0px"
                }
            },400)
        }else{
        // OPEN
            $collapse.style.height = "auto"
            $navbar.className += " in";
        }
    }
</script>


    <!-- Main Content -->
    
<!-- Image to hack wechat -->
<!-- <img src="http://reflectyi.gitee.io/myblog/myblog/img/icon_wechat.png" width="0" height="0"> -->
<!-- <img src="{{ site.baseurl }}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}" width="0" height="0"> -->

<!-- Post Header -->
<style type="text/css">
    header.intro-header{
        background-image: url('/myblog/img/home-bg.jpg')
    }
</style>
<header class="intro-header" >
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <div class="tags">
                        
                          <a class="tag" href="/myblog/tags/#jvm" title="jvm">jvm</a>
                        
                          <a class="tag" href="/myblog/tags/#Thread" title="Thread">Thread</a>
                        
                    </div>
                    <h1>java内存模型</h1>
                    <h2 class="subheading">主内存和工作内存、volatile</h2>
                    <span class="meta">
                        Posted by Ethan on
                        2016-10-01
                    </span>
                </div>
            </div>
        </div>
    </div>
</header>

<!-- Post Content -->
<article>
    <div class="container">
        <div class="row">

    <!-- Post Container -->
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                post-container">

                <h2 id="java内存模型"><a href="#java内存模型" class="headerlink" title="java内存模型"></a>java内存模型</h2><ul>
<li>jvm规范定义一种java内存模型(JMM)来屏蔽掉各种硬件和操作系统的内存访问差异。以实现让java程序在不同平台下都能达到一致的内存访问效果。<h3 id="一、主内存和工作内存"><a href="#一、主内存和工作内存" class="headerlink" title="一、主内存和工作内存"></a>一、主内存和工作内存</h3></li>
<li>概述：java内存模型的主要目标，是定义程序中各个变量的访问规则 <ul>
<li>即在jvm中将变量存储到内存和从内存中读取变量的底层细节</li>
<li>这里的变量不包括虚拟机栈和方法参数。</li>
</ul>
</li>
<li>1、主内存：<ul>
<li>所有线程的公共内存 </li>
<li>所有变量都必须保存在主内存中。</li>
<li></li>
</ul>
</li>
<li>2、工作内存<ul>
<li>线程独有，可与处理器高速缓存类比   </li>
<li>工作内存保存了该线程使用到的从主内存中变量的副本拷贝</li>
<li>线程对变量的所有操作必须在自己的工作内存中，不能在主内存中</li>
<li>不同线程中，不能直接访问对方的工作内存，变量值的传递只能通过主内存中转</li>
</ul>
</li>
<li>所有线程间的通信，都要通过主内存中转完成。</li>
<li><strong>Node：</strong>内存模型和以前的运行时数据区(栈，堆，方法区等)并不是同一个层次的内存划分，没有必然关系<h3 id="二、内存交互操作"><a href="#二、内存交互操作" class="headerlink" title="二、内存交互操作"></a>二、内存交互操作</h3></li>
<li>概述：主内存和工作内存之间的交互协议，定义了两者之间数据同步的细节处理(8种操作都具有原子性)。</li>
<li>1、交互协议的八种操作<ul>
<li>lock(锁定)：<strong>作用于主内存的变量</strong>，标识该变量被一个线程独占状态</li>
<li>unlick(解锁)：<strong>作用于主内存的变量</strong>，把处于锁定的主内存的变量释放出来，允许其他线程锁定。</li>
<li>read(读取)：<strong>作用于主内存的变量</strong>，把一个主内存的变量的值传输到线程的工作内存，以便后面的load使用(read的下一个操作必须是load，否则该操作不能是read，这两个操作成对出现)。</li>
<li>load(载入)：<strong>作用于工作内存的变量</strong>，把read从主内存中得到的变量值放入到工作内存</li>
<li>use(使用)：<strong>作用于工作内存的变量</strong>，它把工作内存的一个变量传递给执行引擎。当jvm遇到需要使用需要使用变量值的时候，就会执行这个操作(比如：操作数栈的内容弹栈进行数据计算)</li>
<li>assign(赋值)：<strong>作用域工作内存的变量</strong>，把从执行引擎获取到的值赋值给工作内存变量。每当jvm遇到一个给变量赋值的字节码指令时执行这个操作。(比如：计算完毕后，结果压入操作数栈)</li>
<li>store(存储)：<strong>作用于工作内存的变量</strong>，把工作内存的变量值传递到主内存中。(必然和后续的write成对出现，也就store的后一个操作必然是write) </li>
<li>write(写入)：<strong>作用于主内存的变量</strong>，把从store获取到的变量值，放入到主内存中。<h3 id="三、volatile型变量的特殊规则-针对多核CPU"><a href="#三、volatile型变量的特殊规则-针对多核CPU" class="headerlink" title="三、volatile型变量的特殊规则(针对多核CPU)"></a>三、<code>volatile</code>型变量的特殊规则(针对多核CPU)</h3></li>
</ul>
</li>
<li><p>概述：</p>
<ul>
<li><code>volatile</code>是jvm提供的最轻量级的同步机制，但是并不是线程安全的</li>
<li><code>volatile</code>修饰过得变量，对所有线程可见。即一条线程修改该变量，其他线程理解得知<ul>
<li>普通变量，线程A修改后回写入主内存，线程B主动去主内存读取才能得知该变量的新值。<ul>
<li><code>volatile</code>，线程A修改后回写入主内存，其余线程每次使用前，都必须主动去主内存读取新值(不加锁，一旦读取到操作数栈进行运算，并发情况下就不安全)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><p>1、保证可见性：</p>
<ul>
<li>必须符合以下规则：<ul>
<li>运算结果并不依赖变量的当前值，或者能保证只有单一线程修改变量的值</li>
<li>变量不需要与其他状态变量共同参与不变约束。 </li>
</ul>
</li>
</ul>
</li>
<li>2、禁止重排序<ul>
<li>A线程内部study()最后一行<code>flag=false</code>。线程B根据flag判断是否执行。<ul>
<li>因为重排序的原因，可能造成study()其他代码未执行完，flag被置为true，线程B开始执行</li>
</ul>
</li>
<li>原理：<code>volatile</code>修饰的变量，会增加一个内存屏障。当前修改变量的cpu把catche写入主内存的时候，会造成其他观测cpu的catche失效</li>
</ul>
</li>
<li>3、选择<code>volatile</code>的意义：<ul>
<li>同步机制性能要优于锁，由于锁的消除和优化，很难量化的说明synchronized快多少(大多数情况是比锁开销低)。</li>
<li><code>volatile</code>变量读操作和普通变量差不多，写操作会慢一些(有内存屏障)。</li>
</ul>
</li>
<li>4、<code>volatile</code>对8种交互协议影响(线程T，两个被<code>volatile</code>修饰的变量V、W)<ul>
<li>线程T对变量V的执行动作必须是<code>read、load、use</code>这三者依次顺序。(这条规则保证每次使用V前，都必须先刷新主内存中变量最新值，保证能获取到其他线程对变量V的修改的最新的值)。 </li>
<li>线程T对变量V的执行动作必须是<code>assign、store、write</code>这三者依次顺序(这条规则要求，在工作内存中，每次修改完变量必须同步回主内存，保证其他线程可以看到V的变量的修改)。</li>
<li>修改V和W两个变量，命令有交叉的情况，那么顺序执行(这条规则规定，被<code>volatile</code>修饰的变量不会发生指令重排序，代码的执行顺序和程序的执行顺序相同)<h3 id="四、原子性、可见性和有序性"><a href="#四、原子性、可见性和有序性" class="headerlink" title="四、原子性、可见性和有序性"></a>四、原子性、可见性和有序性</h3></li>
</ul>
</li>
<li>概述：jmm就是围绕并发过程中的原子性、可见性和有序性三个特征展开的</li>
<li>1、原子性：<ul>
<li>内存交互的6种(<code>read、load、use、assign、store以及write</code>)操作(long、double的非原子性协定)保证了基本数据类型操作的原子性。</li>
<li>如果需要更大范围的原子性保证，jmm还提供了<code>lock、unlock</code>反应到java代码就是<code>synchronized</code>关键字</li>
</ul>
</li>
<li>2、可见性：<ul>
<li>当一个线程修改了变量值，其他线程立即得知这个修改</li>
<li><code>volatile</code>关键字保证了修改变量值立即同步回主内存，每次使用前读取主内存中变量的值。其他普通变量不保证可见性。</li>
<li>final关键字可见性。被final修饰的字段在构造器中一旦初始化完成，并且构造器没有把this传递出去(this没有发生引用逃逸)，那在其他线程中就能看到final字段的值。</li>
<li>synchronized加锁，也能保证可见性</li>
</ul>
</li>
<li>3、有序性：<ul>
<li>如果在单线程内部观察操作全部有序，如果一个线程中观察另一个线程那么操作就全部是无序的  <h3 id="五、先行发生原则"><a href="#五、先行发生原则" class="headerlink" title="五、先行发生原则"></a>五、先行发生原则</h3></li>
</ul>
</li>
<li>概述：操作A比操作B先发生，A产生的影响能被B观察到。</li>
<li>规则：<ul>
<li>程序次序规则：本线程内按照程序代码顺序执行。</li>
<li>管程锁定规则：lock之前，变量必须要是unlock(同一个锁)</li>
<li><code>volatile</code>变量规则：对一个<code>volatile</code>修饰的变量写操作先发生于对这个变量的读操作</li>
<li>线程启动规则：Thread的start()现行发生于线程的其他动作</li>
<li>线程终止规则：线程所有的操作，都要在终止之前完成</li>
<li>线程中断规则：对线程的<code>intercept()</code>调用，先行发生于被中断线程的代码检测到中断事件发生。(先中断)</li>
<li>对象终结规则：对象的初始化完成，先行发生于finalize()方法开始。</li>
<li>传递性：A比B先发生，B比C先发生，那么A就比C先发生。</li>
</ul>
</li>
</ul>


                <hr>

                

                <ul class="pager">
                    
                        <li class="previous">
                            <a href="/myblog/2016/10/01/jvm/并发/线程安全/" data-toggle="tooltip" data-placement="top" title="java线程安全">&larr; Previous Post</a>
                        </li>
                    
                    
                        <li class="next">
                            <a href="/myblog/2016/10/01/jvm/并发/锁优化/" data-toggle="tooltip" data-placement="top" title="jvm锁优化">Next Post &rarr;</a>
                        </li>
                    
                </ul>

                

                
                <!-- disqus 评论框 start -->
                <div class="comment">
                    <div id="disqus_thread" class="disqus-thread"></div>
                </div>
                <!-- disqus 评论框 end -->
                

            </div>
    <!-- Side Catalog Container -->
        
            <div class="
                col-lg-2 col-lg-offset-0
                visible-lg-block
                sidebar-container
                catalog-container">
                <div class="side-catalog">
                    <hr class="hidden-sm hidden-xs">
                    <h5>
                        <a class="catalog-toggle" href="#">CATALOG</a>
                    </h5>
                    <ul class="catalog-body"></ul>
                </div>
            </div>
        

    <!-- Sidebar Container -->

            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                sidebar-container">

                <!-- Featured Tags -->
                
                <section>
                    <!-- no hr -->
                    <h5><a href="/myblog/tags/">FEATURED TAGS</a></h5>
                    <div class="tags">
                       
                          <a class="tag" href="/myblog/tags/#jvm" title="jvm">jvm</a>
                        
                          <a class="tag" href="/myblog/tags/#Thread" title="Thread">Thread</a>
                        
                    </div>
                </section>
                

                <!-- Friends Blog -->
                
                <hr>
                <h5>FRIENDS</h5>
                <ul class="list-inline">

                    
                        <li><a href="http://blog.kaijun.rocks" target="_blank">Kaijun&#39;s Blog</a></li>
                    
                        <li><a href="http://huangxuan.me" target="_blank">Hux Blog</a></li>
                    
                        <li><a href="#" target="_blank">Foo</a></li>
                    
                        <li><a href="#" target="_blank">Bar</a></li>
                    
                        <li><a href="#" target="_blank">Example Friends</a></li>
                    
                        <li><a href="#" target="_blank">It helps SEO</a></li>
                    
                </ul>
                
            </div>

        </div>
    </div>
</article>




<!-- disqus 公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES * * */
    var disqus_shortname = "hexo-theme-huxblog";
    var disqus_identifier = "http://reflectyi.gitee.io/myblog/2016/10/01/jvm/并发/java内存模型/";
    var disqus_url = "http://reflectyi.gitee.io/myblog/2016/10/01/jvm/并发/java内存模型/";

    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>
<!-- disqus 公共JS代码 end -->




<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>
<!-- anchor-js, Doc:http://bryanbraun.github.io/anchorjs/ -->
<script>
    async("https://cdn.bootcss.com/anchor-js/1.1.1/anchor.min.js",function(){
        anchors.options = {
          visible: 'always',
          placement: 'right',
          icon: '#'
        };
        anchors.add().remove('.intro-header h1').remove('.subheading').remove('.sidebar-container h5');
    })
</script>
<style>
    /* place left on bigger screen */
    @media all and (min-width: 800px) {
        .anchorjs-link{
            position: absolute;
            left: -0.75em;
            font-size: 1.1em;
            margin-top : -0.1em;
        }
    }
</style>



    <!-- Footer -->
    <!-- Footer -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                
                
                

                

                
                    <li>
                        <a target="_blank" href="https://www.facebook.com/stateInstance">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                

                
                    <li>
                        <a target="_blank"  href="https://github.com/stateInstance">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                

                

                </ul>
                <p class="copyright text-muted">
                    Copyright &copy; Hi,Ethan 2019 
                    <br>
                    Theme by <a href="http://huangxuan.me">Hux</a> 
                    <span style="display: inline-block; margin: 0 5px;">
                        <i class="fa fa-heart"></i>
                    </span> 
                    Ported by <a href="http://blog.kaijun.rocks">Kaijun</a> | 
                    <iframe
                        style="margin-left: 2px; margin-bottom:-5px;"
                        frameborder="0" scrolling="0" width="91px" height="20px"
                        src="https://ghbtns.com/github-btn.html?user=kaijun&repo=hexo-theme-huxblog&type=star&count=true" >
                    </iframe>
                </p>
            </div>
        </div>
    </div>
</footer>

<!-- jQuery -->
<script src="/myblog/js/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="/myblog/js/bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="/myblog/js/hux-blog.min.js"></script>


<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>

<!-- 
     Because of the native support for backtick-style fenced code blocks 
     right within the Markdown is landed in Github Pages, 
     From V1.6, There is no need for Highlight.js, 
     so Huxblog drops it officially.

     - https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0  
     - https://help.github.com/articles/creating-and-highlighting-code-blocks/    
-->
<!--
    <script>
        async("http://cdn.bootcss.com/highlight.js/8.6/highlight.min.js", function(){
            hljs.initHighlightingOnLoad();
        })
    </script>
    <link href="http://cdn.bootcss.com/highlight.js/8.6/styles/github.min.css" rel="stylesheet">
-->


<!-- jquery.tagcloud.js -->
<script>
    // only load tagcloud.js in tag.html
    if($('#tag_cloud').length !== 0){
        async("http://reflectyi.gitee.io/myblog/myblog/js/jquery.tagcloud.js",function(){
            $.fn.tagcloud.defaults = {
                //size: {start: 1, end: 1, unit: 'em'},
                color: {start: '#bbbbee', end: '#0085a1'},
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>

<!--fastClick.js -->
<script>
    async("https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>


<!-- Google Analytics -->


<script>
    // dynamic User by Hux
    var _gaId = 'UA-49627206-1';
    var _gaDomain = 'huangxuan.me';

    // Originial
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', _gaId, _gaDomain);
    ga('send', 'pageview');
</script>




<!-- Baidu Tongji -->

<script>
    // dynamic User by Hux
    var _baId = '4cc1f2d8f3067386cc5cdb626a202900';

    // Originial
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?" + _baId;
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
</script>


<!-- Side Catalog -->

<script type="text/javascript">
    function generateCatalog (selector) {
        var P = $('div.post-container'),a,n,t,l,i,c;
        a = P.find('h1,h2,h3,h4,h5,h6');
        a.each(function () {
            n = $(this).prop('tagName').toLowerCase();
            i = "#"+$(this).prop('id');
            t = $(this).text();
            c = $('<a href="'+i+'" rel="nofollow">'+t+'</a>');
            l = $('<li class="'+n+'_nav"></li>').append(c);
            $(selector).append(l);
        });
        return true;    
    }

    generateCatalog(".catalog-body");

    // toggle side catalog
    $(".catalog-toggle").click((function(e){
        e.preventDefault();
        $('.side-catalog').toggleClass("fold")
    }))

    /*
     * Doc: https://github.com/davist11/jQuery-One-Page-Nav
     * Fork by Hux to support padding
     */
    async("/myblog/js/jquery.nav.js", function () {
        $('.catalog-body').onePageNav({
            currentClass: "active",
            changeHash: !1,
            easing: "swing",
            filter: "",
            scrollSpeed: 700,
            scrollOffset: 0,
            scrollThreshold: .2,
            begin: null,
            end: null,
            scrollChange: null,
            padding: 80
        });
    });
</script>





<!-- Image to hack wechat -->
<img src="http://reflectyi.gitee.io/myblog/myblog/img/icon_wechat.png" width="0" height="0" />
<!-- Migrate from head to bottom, no longer block render and still work -->

</body>

</html>
